Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Added a code example for the PhotonPoseEstimator Optional #321

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LJWsao
Copy link

@LJWsao LJWsao commented Jan 15, 2024

No description provided.

@mdurrani808
Copy link
Contributor

This should follow the style of our other exampled, or PRed to the main repo and made into the RLI in one of our other examples.

if (result.hasTargets()) { //Make
var update = photonPoseEstimator.update();
Pose3d currentPose3d = update.get().estimatedPose;
botPose = currentPose3d.toPose2d();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two variables should have explicit types

@@ -104,6 +104,15 @@ Calling ``update()`` on your ``PhotonPoseEstimator`` will return an ``EstimatedR
}

You should be updating your `drivetrain pose estimator <https://docs.wpilib.org/en/latest/docs/software/advanced-controls/state-space/state-space-pose-estimators.html>`_ with the result from the ``RobotPoseEstimator`` every loop using ``addVisionMeasurement()``. TODO: add example note
.. tab-set-code::
.. code-block:: java
var result = photonCam_1.getLatestResult();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also show initialization of this camera explicitly? Also var is discouraged in our docs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback. I will make sure to be way more thorough next time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants